package com.ds.infra.rpc.example.api.exception;

import lombok.Getter;

/**
 * API通用异常
 */
@Getter
public class ApiException extends Exception {

    private static final long serialVersionUID = -3043506390487708558L;
    private final String errorCode;

    public ApiException(String errorCode, String message) {
        super(message);
        this.errorCode = errorCode;
    }

    public ApiException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.errorCode = errorCode.getCode();
    }

}
